home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / tpfort12.zip / FORTLINK.DOC < prev    next >
Text File  |  1989-11-21  |  2KB  |  64 lines

  1. unit FortLink;
  2.  
  3. { TPFORT unit to link in fortran routines.  See TPFORT.DOC for instructions. }
  4. { This file contains the interface section only.                             }
  5.  
  6. interface
  7.   uses Dos;
  8.  
  9. type
  10.   Extval     = longint;
  11.   Double_Ptr = ^double;
  12.   RealArray  = array[1..65520 div sizeof(double)] of double;
  13.  
  14. const
  15.   MaxProcs  = 32;  { Recompile this as large as necessary.
  16.                      Overhead is 4*maxprocs }
  17.   Extra_Space : word = 1024;  { Extra space for the Fortran loader's heap.  
  18.                                 Increase if loadfort fails with Exec error 8
  19.                                 or Fortran complains }
  20.   LinkedProcs   : word = 0;  { The number of procedures linked so far.  Use
  21.                                for automatic procedure numbering in unit
  22.                                initializations }
  23. var
  24.   FortLoaded    : boolean;   { True indicates Fortran routines are in memory }
  25.   FortSafe      : boolean;   { True indicates you're in Fortran mode }
  26.  
  27. function LoadFort(Prog:string;TPentry:pointer):boolean;
  28. { The procedure to load the fortran routines.  Returns true on success. }
  29.  
  30. procedure CallFort(ProcNum:word);
  31. { The procedure to call the Fortran routine number procnum }
  32. { Works for SUBROUTINES and FUNCTIONS with values up to 4 bytes (except REAL*4)}
  33.  
  34. procedure FSingle(procnum:word);
  35. { Simulates a Fortran REAL*4 Function call }
  36.  
  37. procedure FDouble(procnum:word);
  38. { Simulates a Fortran Double Precision Function call }
  39.  
  40. procedure FPointer(procnum:word);
  41. { Simulates a Fortran Function call with a value up to 8 bytes long, by
  42.   returning a pointer to it.  Can reserve space for longer return values by
  43.   passing multiple copies of the function to CALLTP, and only using the
  44.   first.
  45. }
  46.  
  47. function Fort_External(ProcNum:word):Extval;
  48. { Returns value to be passed as an external reference }
  49.  
  50. function Pas_External(Proc:pointer):Extval;
  51. { Returns value to be passed as an external reference for
  52.   a Pascal procedure or specially constructed function
  53. }
  54.  
  55. procedure Clean_External;
  56. { Routine to clean up stack after Fort_External or Pas_External }
  57.  
  58. procedure Enter_Pascal;
  59. { Set up Pascal context. Always pair with Leave_Pascal! }
  60.  
  61. procedure Leave_Pascal;
  62. { Restore Fortran context. Always pair with Enter_Pascal! }
  63.  
  64.